<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title>电商概览 - 电商ERP系统</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">
<div class="layui-body" style="padding:15px;background: #f2f2f2;">

    <style>
        .message-body{

        }
        .message-top{
            background: #fff;
            padding:30px;
        }
        .message-body .content-title{

            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .message-body .content-title .label{
            font-weight: bold;
            font-size: 16px;
            color: #333;
        }
        .message-body .content-title span{
            font-size: 13px;
            color: #999;
            margin-left: 5px;
        }
        .message-body .order-list{
            display: flex;
            align-items: center;
            justify-content: space-around;
            background: #F2F2F2;
        }
        .message-body .order-item{
            width: 20%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 40px 0;
            margin: 10px;
            background: #fff;
        }
        .message-body .order-item-sub{
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin: 5px;
            padding: 20px;
            background: #fff;
        }
        .message-body .order-label{
            font-size: 14px;
            color: #999;
        }
        .message-body .order-num{
            margin-top:20px;
            font-size: 20px;
            font-weight: bold;
        }
        .message-card-box{
            background: #fff;
            margin: 10px auto;
            padding: 60px 0;
        }
        .my-tab-brief{
            background: #fff;
            width: 90%;
            margin: 0 auto;
        }
        .my-tab-brief .layui-tab-title{
            background: #fff;
            display: flex;

        }
        .my-tab-brief .layui-tab-title li{
            border-right: 1px solid #e6e6e6;
            width: 20%;
            padding: 0;
            margin: 0;
        }
        .my-tab-brief .layui-tab-title span{
            color: #FF5722;
            margin-left: 5px;
            font-weight: bold;
        }
        .my-tab-brief .layui-tab-title li:last-child{
            border-right: none;
        }
        .my-tab-brief .layui-tab-title .layui-this{
            border-right: none;
            background: #009688;
            color: #fff;
        }
        .my-tab-brief  .massgae-box{
            padding: 0 15px;
        }
        .my-tab-brief .message-item{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 0;
            line-height: 24px;
            color: #999;
        }
        .message-left{
            width: 80%;
            display: flex;
            align-items: center;
        }
        .message-left img{
            margin-right: 5px;
            width: 22px;
            height: 22px;
            object-fit: contain;
        }

        .message-right{
            color: #999;
        }

    </style>
    <h1 th:text="${msg}"></h1>

    <div class="message-body">
        <div class="message-top">
            <div class="content-title">
                    <span class="label" style="padding-bottom:30px;">订单总览</span>
            </div>
            <div class="order-list">

                <div class="order-item" >
                    <div class="order-label">待发货订单</div>
                    <div class="order-num" th:text="${waitSendOrder}" style="color: red">100</div>
                </div>

                <div class="order-item">
                    <div class="order-label">今日订单</div>
                    <div class="order-num" th:text="${todayOrderTotal}" style="color: #018AED">100</div>
                </div>
                <div class="order-item">
                    <div class="order-label">今日有效订单</div>
                    <div class="order-num" th:text="${todayValidOrder}" style="color: #9F9F9F">100</div>
                </div>
                <div class="order-item">
                    <div class="order-label">今日成交金额</div>
                    <div class="order-num"  th:text="${#numbers.formatDecimal(todayValidOrderAmout, 1, 2)}" style="color: red">100</div>
                </div>
                <div class="order-item">
                    <div class="order-label">待处理退货</div>
                    <div class="order-num" th:text="${waitAuditReturn}" style="color: #28a605">100</div>
                </div>
               
            </div>
        </div>
    </div>

    <div class="layui-elem-field message-body" style="background-color: #fff;">
        <span ><img src="/images/JKL-mashujianyi.png"  title="JKL码数推荐" style="height:300px"></span>
        <span ><img src="/images/HN-mashujianyi.png"  title="HN码数推荐" style="height:300px"></span>
    </div>


        <div class="layui-elem-field message-body" style="background-color: #fff;">
            <legend>店铺</legend>
                <div class="order-list layui-field-box" style="background-color: #fff;">
                    <fieldset class="layui-elem-field order-item"  th:each="item:${shops}">
                        <legend>
                            <img th:if="${item.type == 7}" src="https://www.xiaohongshu.com/favicon.ico" width="20px" height="20px">
                            <img th:if="${item.type == 5}" src="https://mms-static.pddpic.com/express/favicon.ico" width="20px" height="20px">
                            <img th:if="${item.type == 4}" src="https://img.alicdn.com/tps/i3/T1OjaVFl4dXXa.JOZB-114-114.png" width="20px" height="20px">
                            <img th:if="${item.type == 6}" src="https://lf1-fe.ecombdstatic.com/obj/eden-cn/upqphj/homepage/icon.svg" width="20px" height="20px">
                            <span th:text="${item.name}"></span>
                        </legend>
                        <a class="" th:href="@{'/shop/dashboard?shopId='+${item.getId()}}">
                            <div class="order-list">
                                <div class="order-item-sub">
                                    <div class="order-label">待发货</div>
                                    <div class="order-num" th:text="${item.waitSendOrder}" style="color: #28a605">100</div>
                                </div>
                                <div class="order-item-sub">
                                    <div class="order-label">今日订单</div>
                                    <div class="order-num" >
                                        <span th:text="${item.todayValidOrder}" style="color: #28a605"></span>
                                        <span style="font-size: small;color: #9F9F9F; text-decoration:line-through;" th:text="${item.todayOrderCount}">10</span>
                                    </div>
                                    
                                </div>
                                <div class="order-item-sub">
                                    <div class="order-label">成交金额</div>
                                    <div class="order-num" th:text="${#numbers.formatDecimal(item.todayValidOrderAmout, 1, 2)}" style="color: #28a605">100</div>
                                    
                                </div>
 
               
                            </div>
                           

                        </a>
                        <div class="order-list"  th:if="${item.type == 5}"  style="padding-top: 20px;margin-top: 20px;background-color: #fff;">
                            <div class="layui-inline" >
                                <span  th:attr="shopId=${item.getId()}" class="layui-btn upd_pdd_order layui-btn-warm layui-btn-sm">拉取pdd订单</span>
                                <span  style="display: none;" class="update upd_pdd_order_"><i></i>拉取中</span>
                            </div>
                        </div>
                        <a class="order-list"  th:if="${item.type == 6}" th:href="@{/douyin/order_excel_import_review(shopId=${item.getId()})}"  style="padding-top: 20px;margin-top: 20px;background-color: #fff;">
                            <div class="layui-inline" >
                                <span  th:attr="shopId=${item.getId()}" class="layui-btn layui-btn-primary layui-btn-sm">导入抖店订单</span>
                            </div>
                        </a>
                        <a class="order-list"  th:if="${item.type == 4}" th:href="@{/tao/order_excel_import_review(shopId=${item.getId()})}"  style="padding-top: 20px;margin-top: 20px;background-color: #fff;">
                            <div class="layui-inline" >
                                <span  th:attr="shopId=${item.getId()}" class="layui-btn layui-btn-primary layui-btn-sm">导入淘宝订单</span>
                            </div>
                        </a>
                    </fieldset>
                </div>

            </div>

        <fieldset class="layui-elem-field ">
            <legend>代办</legend>
            <div class="message-card-box">
                <div class="layui-tab layui-tab-card my-tab-brief">
                    <!-- <ul class="layui-tab-title">
                        <li class="layui-this">代办<span></span></li>
                        <li>订单信息<span></span></li>
                        <li>退款信息<span></span></li>
                        <li>发布新商品 <span></span></li>
                        <li>库存预警<span></span></li>
                    </ul> -->
                    <div class="layui-tab-content" style="min-height: 100px;">
                        <div class="layui-tab-item layui-show">
                            <div class="massgae-box">
                                <div class="message-item" th:each="item:${todoList}">
                                    <div class="message-left">
                                        <i th:if="${item.status == 1}"
                                            class="layui-icon layui-icon-loading-1 layui-icon layui-anim layui-anim-rotate layui-anim-loop"
                                            title="处理中"></i>
                                        <i th:if="${item.status == 0}" class="layui-icon layui-icon-help"
                                            title="待处理"></i>

                                        <span th:text="${item.content}"
                                            style="padding-left: 5px;margin-left: 5px;"></span>
                                        <span style="color: red;padding-left: 20px;margin-left: 20px;"
                                            th:text="${item.result}"></span>
                                    </div>
                                    <div class="message-right">
                                        <span th:text="${item.updateTime}"></span>
                                    </div>
                                </div>

                            </div>



                        </div>
                        <div class="layui-tab-item">

                        </div>
                        <div class="layui-tab-item"></div>
                        <div class="layui-tab-item"></div>
                        <div class="layui-tab-item"></div>
                        <div class="layui-tab-item"></div>
                    </div>
                </div>

            </div>
        </fieldset>


        <div class="message-body">
        <div class="message-card-box">
            <div class="layui-tab layui-tab-card my-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">全部信息<span></span></li>
                    <li>订单信息<span></span></li>
                    <li>退款信息<span></span></li>
                    <li>发布新商品 <span></span></li>
                    <li>库存预警<span></span></li>
                </ul>
                <div class="layui-tab-content" style="min-height: 100px;">
                    <div class="layui-tab-item layui-show">
                        
                            <!-- <div class="dd-wrapper">
                                <table class="dd-table">
                                    <tbody><tr>
                                        <th>序号</th>
                                        <th>pdd GoodsId</th>
                                        <th width="80px">主图</th>
                                        <th>商品标题</th>
                                        <th>erpGoodsId</th>
                                        <th>销售数量(<span id="quantity">55</span>)</th>
                                        <th>销售金额(<span id="amount">￥1168.18</span>)</th>
                                        <th>成本</th>
                                        <th>盈亏(<span style="color: red;" id="yingkuit">￥36.18</span>)</th>
                                    </tr>
                                    <tr>
                                        <td>1</td>
                                       
                                        <td>392657083276</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-29/7aad56ca6d40a944967ea780b93275fe.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>牛仔短裤女夏天外穿2022新款高腰宽松直筒甜欲风辣妹黑色白色蓝色</span></td>
                                        <td>
                                            <span>9</span>
                                        </td>
                                        
                                        <td><span class="quantity">28</span></td>
                                        <td><span class="amount">414.60</span></td>
                                        <td><span>532.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">-117.40</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>2</td>
                                       
                                        <td>393654097571</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-23/58da809ecc22d16d8dc360d31e4cd064.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>弹力牛仔短裤女夏2022年新款春夏高腰显瘦显高阔腿辣妹a字热裤子</span></td>
                                        <td>
                                            <span>12</span>
                                        </td>
                                        
                                        <td><span class="quantity">1</span></td>
                                        <td><span class="amount">33.99</span></td>
                                        <td><span>19.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">14.99</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>3</td>
                                       
                                        <td>393659007414</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-23/765251126e15e6d2552eb18f8db50530.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>高腰牛仔短裤女弹力抽绳2022新款阔腿宽松显瘦设计感A字型热裤</span></td>
                                        <td>
                                            <span>10</span>
                                        </td>
                                        
                                        <td><span class="quantity">18</span></td>
                                        <td><span class="amount">500.40</span></td>
                                        <td><span>414.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">86.40</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>4</td>
                                       
                                        <td>394802014653</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-26/3d204838755351d1df223b354ce1c7b7.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>设计感抽绳修身短袖T恤露腰甜辣风女装2022夏季新款甜美正肩上衣</span></td>
                                        <td>
                                            <span>17</span>
                                        </td>
                                        
                                        <td><span class="quantity">2</span></td>
                                        <td><span class="amount">26.20</span></td>
                                        <td><span>18.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">08.20</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>5</td>
                                       
                                        <td>395429166799</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-28/4ef137695d707cc4326e6ffb4ff7e1b9.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>复古牛仔裤女夏季薄款高腰显瘦2022新款宽松直筒BF风垂感阔腿拖地</span></td>
                                        <td>
                                            <span>15</span>
                                        </td>
                                        
                                        <td><span class="quantity">1</span></td>
                                        <td><span class="amount">38.99</span></td>
                                        <td><span>29.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">09.99</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>6</td>
                                       
                                        <td>395930868595</td>
                                        <td>
                                            <div><img src="https://img.pddpic.com/gaudit-image/2022-07-29/17512a628b9243cc3ef0a520e808d292.jpeg" width="80px" height="80px">
                                            </div>
                                        </td>
                                        <td><span>灰色牛仔短裤女夏新款双扣超高腰贴标a字热裤潮ins网红卷边阔腿裤</span></td>
                                        <td>
                                            <span>14</span>
                                        </td>
                                        
                                        <td><span class="quantity">5</span></td>
                                        <td><span class="amount">154.00</span></td>
                                        <td><span>120.00</span></td>
                                        <td>
                                            <span style="color: #ed0119;" class="yingkui">34.00</span>
                                        </td>
                                    </tr>
                                </tbody></table>
                            </div> -->
                           
                   
                    </div>
                    <div class="layui-tab-item">
                        <div class="massgae-box">
                            <div class="message-item">
                               <div class="message-left">
                                   <img src="./image/green-icon.png" alt="">
                                   <span>您有一条新的订单信息</span>
                               </div>
                               <div class="message-right">
                                   2020-03-12  21:56:22
                               </div>
                           </div>
                           <div class="message-item">
                               <div class="message-left">
                                   <img src="./image/danger-icon.png" alt="">
                                   <span>您有一条新的退款信息</span>
                               </div>
                               <div class="message-right">
                                   2020-03-12  21:56:22
                               </div>
                           </div>
                           <div class="message-item">
                               <div class="message-left">
                                   <img src="./image/tip-icon.png" alt="">
                                   <span>有新商品发布</span>
                               </div>
                               <div class="message-right">
                                   2020-03-12  21:56:22
                               </div>
                           </div>
                        </div>
                    </div>
                    <div class="layui-tab-item"></div>
                    <div class="layui-tab-item"></div>
                    <div class="layui-tab-item"></div>
                    <div class="layui-tab-item"></div>
                </div>
            </div>

        </div>
    </div>

    <script type="text/javascript" src="/goods/Tips/Tips.min.js"></script>

    <script>
        $(function () {
            //更新订单
            $(".upd_pdd_order").click(function () {
                    var shopId = $(this).attr('shopId');
                    if(shopId==0||shopId == ''||shopId =='null'||shopId==null) {alert("请选择店铺");return;}

                    if(!confirm("要拉取订单吗？")) return;
                    var $this =  $(this);
                    
                    $this.hide();
                    $this.siblings("upd_pdd_order_").show();
                    let data = {
                        startTime:null,
                        endTime:null,
                        updType:0,
                        shopId:shopId
                    };

                    $.ajax({
                        url: "/ajax_pdd/pull_order",
                        type: "POST",
                        dataType: "JSON",
                        contentType: 'application/json',
                        data:JSON.stringify(data),
                        success: function (res) {
                            if (res.code == 0) {
                                Tips.alert({
                                    title: '更新订单',
                                    content: '更新结果：【'+JSON.stringify(res.data )+'】',
                                    define: function () {
                                        // location.href = "/pdd/order_list?shopId="+shopId;
                                        location.reload();
                                    }
                                });
                            }else if(res.code==601){
                                // $("#upd_order").show();
                                // $("#upd_order_").hide();
                                alert(res.msg);
                                // Tips.alert(res.msg);
                                location.href = "/pdd/oauth?shopId="+shopId;
                            }
                            else {

                                Tips.alert(res.msg);
                            }
                            $this.show();
                            $this.siblings("upd_pdd_order_").hide();
                        }
                    })
                });

        })
    </script>
</div>
</body>
</html>
